import Quick from ".";
import { WeaInput, WeaLocaleProvider } from 'ecCom';
const { getLabel } = WeaLocaleProvider;

export default class Main extends Quick {
    state = {
        field: ''
    }
    getComponent = () => {
        const { field, value } = this.state;
        return [
            <div>
                <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@dkh4pk@`}
                    style={{ width: 200 }}
                    placeholder={getLabel('511723','请输入字段名称')}
                    value={field}
                    onChange={v => this.setState({ field: v })}
                />
            </div>,
            <div style={{marginTop:8}}>
                <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@inbp8w@`}
                    style={{ width: 200 }}
                    placeholder={getLabel('511725','请输入字段值')}
                    value={value}
                    onChange={v => this.setState({ value: v })}
                />
            </div>
        ]
    }
    getTitle = () => {
        return 'excel.setFieldValue';
    }
    getScript = () => {
        return `excel.setFieldValue('${this.state.field}','${this.state.value}');`
    }
}